package jmu.edu.yjc.controller;

import jmu.edu.yjc.domain.ResponseResult;
import jmu.edu.yjc.domain.vo.common.TypeVo;
import jmu.edu.yjc.service.ElderlyService;
import jmu.edu.yjc.service.HealthyService;
import jmu.edu.yjc.service.PageViewService;
import jmu.edu.yjc.service.user.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yjc
 * @date 2023/4/8 17:21
 */
@RestController
@RequestMapping("/system/dashboard")
public class DashBoardController {
    @Resource
    private UserService userService;
    @Resource
    private ElderlyService elderlyService;
    @Resource
    private PageViewService pageViewService;
    @Resource
    private HealthyService healthyService;
    @GetMapping("/getUserAreaList")
    public ResponseResult getUserAreaList() {
        List<String> userAreaList = userService.getUserAreaList();
        return ResponseResult.okResult(userAreaList);
    }
    @GetMapping("/getAgeType")
    public ResponseResult getAgeType() {
        List<TypeVo> typeVoList = elderlyService.getAgeType();
        return ResponseResult.okResult(typeVoList);
    }
    @GetMapping("/viewCount")
    public ResponseResult getViewCount() {
        List<String> viewCount = pageViewService.getViewCount();
        return ResponseResult.okResult(viewCount);
    }
    @GetMapping("/getDangerElderly")
    public ResponseResult getDangerElderly(Integer pageNum, Integer pageSize) {
        return healthyService.getDangerElderly(pageNum, pageSize);
    }
}
